package com.zzw.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolTest {

	public static void main(String[] args) throws Exception{
		System.out.println("test");
		ExecutorService service = Executors.newFixedThreadPool(1);
		for (int i = 0 ;i < 2;i++){
			Runnable target = new Runnable(){

				@Override
				public void run() {
					for(int i = 0;i < 5;i++){
						try {
							Thread.sleep(100);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						System.out.println(Thread.currentThread().getName() + "i=" + i);
					}
				}
			};
			service.submit(target);
		}

		service.shutdown();
	}
}
